﻿
Public Class eventTarget
    Public Const functionName As String = "et"

    Public Shared Sub register(ByVal inlineScript As inlineScript)
        assert(Not inlineScript Is Nothing)
        inlineScript.addscript(functionName, "function " + functionName + "(e){return e.srcElement||e.target;}")
    End Sub

    Public Shared Function invoke(ByVal inlineScript As inlineScript, ByVal e As String, _
                                  Optional ByRef actionTarget As String = Nothing) As String
        If Not inlineScript Is Nothing Then
            register(inlineScript)
        End If

        actionTarget += functionName + "(" + e + ")"
        Return actionTarget
    End Function
End Class
